
#ifndef _MEMBER_BXMLDOCUMENT_H_
#define _MEMBER_BXMLDOCUMENT_H_

#include <BXmlDocument>
#include "member_BXmlNode.h"

#define xmldoc_member(document)	((member_BXmlDocument*)((BXmlDocument*)document)->_ptr)

namespace BWE
{
	class member_BXmlDocument
	{
	public:
		member_BXmlDocument(BXmlDocument* xmldocument);
		~member_BXmlDocument();

		void makeFormat(BXmlNode* node);
		const XmlFormat* nodeFormat(const BXmlNode* node);

		int readTagName(const BString& tagText, BString& name);
		void readAttribs(BXmlNode* node, BString& text);
		void readDoctype(BXmlNode* node, BString& text);
		bool convertText(const BString& name, BString& text);
		
		bool readComment(BXmlNode* node, const BString& sontext, int& pos);
		bool readNode(BXmlNode* node, const BString& xmltext, int& pos);
		void writeNode(const BXmlNode* node, BString& xmltext, int tab);

		BXmlDocument*			boss;
		BString					version;
		BString					encoding;
		XmlFormat				format;
		BXmlNodeHolderArray		nodes;
		BString					doctype;
		BString					convText;
		int						lineNumber;
		int						linePos;
	};
}

#endif
